#ifndef WCCNETWORKREQUESTBASE_H
#define WCCNETWORKREQUESTBASE_H

#include "wccresponse.h"
#include "wccapi_export.h"
#include <QObject>
#include <QUrl>
#include <QNetworkRequest>

class QNetworkReply;

namespace WccNameSpace {
namespace Internal {

class WCCAPI_EXPORT WccNetworkRequestBase : public QObject
{
    Q_OBJECT

public:
    explicit WccNetworkRequestBase(QObject *parent);
    WccNetworkRequestBase(QObject *parent, int id, const QString &url, QNetworkReply *reply = 0);
    virtual ~WccNetworkRequestBase();

    //setters
    void setId(int num);
    void setReply(QNetworkReply *nwReply);
    void setUrl(const QString &url);
    void setUrl(const QUrl &url);
    //getters
    int id() const;
    QNetworkRequest& networkRequest();
    QNetworkReply *reply() const;
    QString url() const;
    WccResponse *response() const;

    virtual void requestFinished();

    // use as grab-bag of request specific data
    QVariantMap m_state;

signals:
    void finished();

protected:
    int m_idNum;
    QUrl m_requestUrl;
    QNetworkRequest m_request;
    QNetworkReply *m_networkReply;
    WccResponse *m_wccResponse;
};

}
}

#endif // WCCNETWORKREQUESTBASE_H
